package com.lagou.task1.work4;

import java.util.List;

public class StudentUpdate {

    public static boolean updateStudent(int num, String name, int age, List<Student> list){
        Student student = new Student();
        student.setNum(num);
        student.setName(name);
        student.setAge(age);
        int i = list.indexOf(student);
        if (i<0){
            System.out.println("学号为" + num + "的学生不存在");
            return false;
        }
        list.set(i,student);
        System.out.println("修改学生成功"+student);
        return true;
    }
}
